#pragma once
#include "Interaction/InteractableQGraphicsItem.h"
#include "Blobz.h"

namespace QtTutorial4
{
	class FriendlyMissile : public QGraphicsItem
	{
	public:
		FriendlyMissile(QGraphicsItem *parent = 0);
		~FriendlyMissile();
		void initialize(QString inAppDirectory);

	public:
		QRectF boundingRect() const;
		const bool isInside(QPointF inPos) const;
		void update(float inFrameTime);
		void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

	public:
		void setSize(QSizeF inSize) { mSize = inSize; }
		float getRadius() const { return mSize.width()/2.0f; }

		void setTargetPosition(const QVector2D& inTargetPosition) { mTargetPosition = inTargetPosition; }	
		const QVector2D& targetPosition() const { return mTargetPosition; }	
		
		const bool exploded() const { return mExploded; }
		const bool isExploding() const { return mExploding; }
		
	private:
		QString mApplicationDirectory;
		QVector2D mTargetPosition;
		QVector2D mTrailEndPos;
		QImage mImage;
		QImage mExplosion;
		QSizeF mSize;
		bool mExploded;
		bool mExploding;
		float mAngle;
		float mExplodeTime;		
	};
}
